package com.tangyuan.user.controller;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.tangyuan.common.result.Result;
import com.tangyuan.model.User;
import com.tangyuan.model.activity.TicketType;
import com.tangyuan.common.util.CommStatus;
import com.tangyuan.user.service.ITicketTypeService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * @Description: ticket_type
 * @Author: jeecg-boot
 * @Date: 2024-03-20
 * @Version: V1.0
 */
@Api(tags = "ticket_type")
@RestController
@RequestMapping("/user")
@Slf4j
public class TicketTypeController {
    @Autowired
    private ITicketTypeService ticketTypeService;


    /**
     * 新增票种
     *
     * @param ticketType
     * @return
     */
    @PostMapping("/addTicketType")
    public Result<Object> addTicketType(@RequestHeader(name = "userId",required = false) Long userId, @RequestBody TicketType ticketType) {
        return ticketTypeService.addTicketType(userId, ticketType);
    }

    /**
     * 查询我的票种
     *
     * @param pageSize
     * @param pageNum
     * @return
     */
    @GetMapping("/getTicketTypes")
    public Result<Object> getTicketTypes(@RequestHeader(name = "userId",required = false) Long userId,
                                         @RequestParam(value = "pageSize") Integer pageSize,
                                         @RequestParam(value = "pageNum") Integer pageNum) {
        return ticketTypeService.getTicketTypes(userId,pageNum,pageSize);
    }

    /**
     * 修改票种
     *
     * @param ticketType
     * @return
     */
    @PostMapping("/exitTicketType")
    public Result<Object> exitTicketType(@RequestHeader(name = "userId",required = false) Long userId, @RequestBody TicketType ticketType) {
        return ticketTypeService.exitTicketType(userId,ticketType);
    }

    /**
     * 删除票种
     *
     * @param ticketType
     * @return
     */
    @GetMapping("/deleteTicketType")
    public Result<Object> deleteTicketType(@RequestHeader(name = "userId",required = false) Long userId, TicketType ticketType) {
        return ticketTypeService.deleteTicketType(userId,ticketType);
    }
}
